# -*- coding: utf-8 -*-

def select_sort(a):
    new_list = []
    for i in range(len(a)):
        tmp = 0
        for x in range(len(a)):
            tmp = x if a[x] > a[tmp] else tmp
        new_list.append(a.pop(tmp))

    return new_list

def select_sort1(a):
    length = len(a)
    for i in range(length):
        tmp = i
        for x in range(i, length):
            tmp = x if a[x] > a[tmp] else tmp
        a[i], a[tmp] = a[tmp], a[i]
    return a

if __name__ == '__main__':
    print select_sort1([3, 2, 6, 7, 9])
